using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Security;

namespace Emlyn.Common.Tools.Encryption
{
    public class OneWayHash
    {
        public string Hash(string aRawInput)
        {
            FormsAuthentication lfa = new FormsAuthentication();

            return FormsAuthentication.HashPasswordForStoringInConfigFile(
                aRawInput,
                System.Web.Configuration.FormsAuthPasswordFormat.MD5.ToString()
            );
        }

        public bool InputMatchesHashedValue(string aRawInput, string aHashedValue)
        {
            return aHashedValue == Hash(aRawInput);
        }
    }
}
